package FinancePersonalPackage;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.swing.JOptionPane;

public class ConexaoDB {

	private ConexaoDB() {
	}
	
	private static Connection instance;
	
	public static Connection getConexao() {
		
		if (instance == null) {
			try {
				instance = DriverManager.getConnection("jdbc:mysql://localhost/financepersonal?user=root&password=");
			}
			catch (SQLException e) {
				JOptionPane.showMessageDialog(null, ("Erro: " + e.getMessage()), "Erro", JOptionPane.ERROR_MESSAGE);			
			}
		}
		
		return instance;
	}
	
}
